Skip to content

feat: Populate OpenFeature flag metadata from the evaluation reason - #1869

Draft
kinyoklion wants to merge 1 commit into
mainfrom
devin/node-flag-metadata
Draft

feat: Populate OpenFeature flag metadata from the evaluation reason#1869
kinyoklion wants to merge 1 commit into
mainfrom
devin/node-flag-metadata

Conversation

@kinyoklion

Copy link
Copy Markdown
Member

Populates OpenFeature flag metadata from the LaunchDarkly evaluation reason so consumers (and the OpenFeature/OTel telemetry hooks) can read experiment, rule, prerequisite, and Big Segments information.

  • Adds flat, camelCase keys variationIndex, inExperiment, ruleIndex, ruleId, prerequisiteKey, bigSegmentsStatus; each is omitted when it does not apply.
  • Applies to the shared server translator, so it covers the Node provider (and any future server provider built on it).
  • Matches the behavior now specified in sdk-specs#253 and implemented in the Java, .NET, Python, and Ruby providers.
  • Documents the keys in the Node provider README.

@cursor review

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions
Implementation details

translateResult now builds a FlagMetadata object from LDEvaluationDetail:

  • variationIndex is included only when the SDK returned a variation, so default/error evaluations omit it.
  • inExperiment is emitted only when true, rather than emitting false for every non-experiment evaluation.
  • ruleIndex/ruleId, prerequisiteKey, and bigSegmentsStatus are copied through when the reason provides them.

Key names are named constants so they cannot drift from the spec.

Backend-only change; no UI, so no screenshots or staging preview apply.

Testing: yarn workspace @launchdarkly/openfeature-js-server-common test and ... lint, plus yarn workspace @launchdarkly/openfeature-node-server test. The existing BaseOpenFeatureProvider result assertions were updated for the added flagMetadata field.

Describe alternatives you've considered

Emitting the full reason object under a single nested key was rejected — OpenFeature flag metadata values must be scalars, and flat keys are what the spec draft standardizes across providers.

Link to Devin session: https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
Requested by: @kinyoklion

Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
@kinyoklion kinyoklion self-assigned this Aug 19, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot added the devin-pr PRs created by Devin AI label Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26360 bytes
Compressed size limit: 29000
Uncompressed size: 129188 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179887 bytes
Compressed size limit: 200000
Uncompressed size: 833430 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 32444 bytes
Compressed size limit: 34000
Uncompressed size: 116232 bytes

@github-actions

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 41502 bytes
Compressed size limit: 44000
Uncompressed size: 224541 bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devin-pr PRs created by Devin AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant